//
//  ShellIncomeStatementCell.m
//  ShellWallert
//
//  Created by lvzhao on 2019/10/9.
//  Copyright © 2019年 VV. All rights reserved.
//

#import "ShellIncomeStatementCell.h"
#import "ShellIncomeStatementModel.h"
#import "QCStar.h"

@interface ShellIncomeStatementCell()

//信用分
@property (nonatomic,strong) UILabel *creditLab;

//可质押(USDT)
@property (nonatomic,strong) UILabel *pledgeLabel;

//订单
@property (nonatomic,strong) UILabel *orderLab;

//收益
@property (nonatomic,strong) QCStar *starView;

@end

@implementation ShellIncomeStatementCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = COLOR_TINT;
        [self setupView];
    }
    return self;
}


#pragma mark - setupView
- (void)setupView{
    
    //信用分
    [self.contentView addSubview:self.creditLab];
    [self.creditLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.left.mas_equalTo(0);
        make.width.mas_equalTo(55);
        make.height.mas_equalTo(self.contentView);
    }];
    
    //可质押(USDT)
    [self.contentView addSubview:self.pledgeLabel];
    [self.pledgeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.left.mas_equalTo(60);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(self.contentView);
    }];
    
    
    //订单
    [self.contentView addSubview:self.orderLab];
    [self.orderLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.left.mas_equalTo(145);
        make.width.mas_equalTo(70);
        make.height.mas_equalTo(self.contentView);
    }];
    
    //收益
    [self.contentView addSubview:self.starView];
    [self.starView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.left.mas_equalTo(220);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(12);
    }];
}


#pragma mark - actions

#pragma mark - custool

#pragma mark - get && set
- (void)setModelObject:(id)modelObject{
    ShellIncomeStatementModel *statementModel = modelObject;

    self.creditLab.text = statementModel.creditScore;
    self.pledgeLabel.text = statementModel.allowedPledge;
    self.orderLab.text = statementModel.orderType;
    self.starView.scorePercent = statementModel.profit / 5.0;
}


//信用分
- (UILabel *)creditLab{
    if(!_creditLab){
        _creditLab = [UILabel lz_createLabWithTextColor:UIColorHex(0xFFFFFF) font:k_textFont(12)];
    }
    return _creditLab;
}

//质押
- (UILabel *)pledgeLabel{
    if(!_pledgeLabel){
        _pledgeLabel = [UILabel lz_createLabWithTextColor:UIColorHex(0xFFFFFF) font:k_textFont(12)];
    }
    return _pledgeLabel;
}


//派单
- (UILabel *)orderLab{
    if(!_orderLab){
        _orderLab = [UILabel lz_createLabWithTextColor:UIColorHex(0xFFFFFF) font:k_textFont(12)];
        _orderLab.adjustsFontSizeToFitWidth = YES;
    }
    return _orderLab;
}

- (QCStar *)starView{
    if(!_starView){
        _starView = [[QCStar alloc] initWithFrame:CGRectMake(220, 9, K_SCREENWIDTH - 100 - 220, 12) numberOfStars:5];
    }
    return _starView;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
